package com.lx.test;

import java.time.Instant;
import java.time.LocalDate;
import java.util.Calendar;

public class yeardemo {
    public static void main(String[] args) {
//        JDK7
        Calendar c = Calendar.getInstance();
        c.set(2000,1,1);
        c.add(Calendar.DAY_OF_MONTH,-1);
        int day = c.get(Calendar.DAY_OF_YEAR);
        if(day==366)
        {
            System.out.println("2019年是润年");
        }
        else
        {
            System.out.println("2019年是平年");
        }
        System.out.println("=====================================");
//        JDK8
        LocalDate ld =LocalDate.of(2000,1,1);
        LocalDate ld1 = ld.minusDays(1);
        int dayOfYear = ld1.getDayOfYear();
        System.out.println(dayOfYear);
    }
}
